package com.bdqn.springboot.service.impl;

import com.bdqn.springboot.dao.BookuserDao;
import com.bdqn.springboot.entity.Bookuser;
import com.bdqn.springboot.service.BookuserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (Bookuser)表服务实现类
 *
 * @author makejava
 * @since 2023-09-07 09:36:06
 */
@Service("bookuserService")
public class BookuserServiceImpl implements BookuserService {
    @Resource
    private BookuserDao bookuserDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Bookuser queryById(Integer id) {
        return this.bookuserDao.queryById(id);
    }



    /**
     * 新增数据
     *
     * @param bookuser 实例对象
     * @return 实例对象
     */
    @Override
    public Bookuser insert(Bookuser bookuser) {
        this.bookuserDao.insert(bookuser);
        return bookuser;
    }

    /**
     * 修改数据
     *
     * @param bookuser 实例对象
     * @return 实例对象
     */
    @Override
    public Bookuser update(Bookuser bookuser) {
        this.bookuserDao.update(bookuser);
        return this.queryById(bookuser.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.bookuserDao.deleteById(id) > 0;
    }
}
